# check percentage of covered stages (only default pacenote)

import asyncio
from argparse import ArgumentParser
import os

async def parse_args():
    p = ArgumentParser()
    p.add_argument("--path", help="path to the folder containing the tracks of custom pacenotes")
    args = p.parse_args()
    args = vars(args)
    return args

async def has_only_default_pacenote(path):
    # check ini files inside the path, if there is only one pacenote file and endwith default.ini
    ini_files = [f for f in os.listdir(path) if f.endswith(".ini")]
    if len(ini_files) == 1:
        return True
    
    return False

async def main():
    args = await parse_args()
    path = args["path"]
    total_tracks = 0
    total_default_pacenote_tracks = 0
    # check all subfolders in the path
    for name in os.listdir(path):
        subfolder = os.path.join(path, name)
        if os.path.isdir(subfolder):
            total_tracks += 1
            if await has_only_default_pacenote(subfolder):
                total_default_pacenote_tracks += 1

    print(f"Total tracks: {total_tracks}")
    print(f"Total tracks with only default pacenote: {total_default_pacenote_tracks}")



if __name__ == "__main__":
    asyncio.run(main())
